package cn.iocoder.yudao.module.system.dal.mysql.book;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;

import cn.iocoder.yudao.module.system.controller.admin.book.vo.BookPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.book.BookDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 绘本 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BookMapper extends BaseMapperX<BookDO> {

    default PageResult<BookDO> selectPage(BookPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BookDO>()
                .eqIfPresent(BookDO::getTitle, reqVO.getTitle())
                .eqIfPresent(BookDO::getCoverUrl, reqVO.getCoverUrl())
                .eqIfPresent(BookDO::getCreatedAt, reqVO.getCreatedAt())
                .orderByDesc(BookDO::getId));
    }

}